package com.oreilly.justspring.core.ch1.ex11;

import java.io.FileNotFoundException;

/**
 * This is a client that reads the data using FileReader. Notice the tight
 * coupling between the client and reader.
 * 
 * @author kondama
 * 
 */
public class DataReaderClient {
  private FileReader fileReader = null;
  private String fileName = "src/main/resources/ex11/ex11-trades-data.txt";

  public DataReaderClient() {
    try {
      fileReader = new FileReader(fileName);
    } catch (FileNotFoundException e) {
      System.out.println("Exception" + e.getMessage());
    }
  }

  private String fetchData() {
    return fileReader.read();
  }

  public static void main(String[] args) {
    DataReaderClient dataReader = new DataReaderClient();
    System.out.println("Example 1.1: Got data: " + dataReader.fetchData());
  }
}
